package com.example.Service.impl;
import com.example.Service.CourseService;
import com.example.entity.Course;
import com.example.mapper.CourseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Service
public class CourseServiceImpl implements CourseService {

    @Autowired
    private CourseMapper courseMapper;

    @Override
    public int addCourse(Course course) {
        return courseMapper.insertCourse(course);
    }

    @Override
    public int deleteCourseById(Integer courseId) {
        return courseMapper.deleteCourseById(courseId);
    }

    @Override
    public int updateCourse(Course course) {
        return courseMapper.updateCourse(course);
    }

    @Override
    public List<Course> getCoursesByUserId(Integer userId) {
        return courseMapper.getCoursesByUserId(userId);
    }
}

